package com.lvcoding.auth2.auth.shizhan.verifycode.parent;

import org.springframework.web.context.request.ServletWebRequest;

/**
 * 验证码接口超类
 */
public interface VerifyCodeHandler<C> {

    String VERIFY_CODE_KEY = "verify:code:";

    /**
     * 保存验证码
     */
    void saveCode(ServletWebRequest servletWebRequest, C verifyCode) throws Exception;

    /**
     * 生成验证码
     */
    C generateCode(ServletWebRequest servletWebRequest) throws Exception;


    /**
     * 模板方法，定义算法
     */
    C handle(ServletWebRequest servletWebRequest) throws Exception;
}
